﻿<?php
class RepositorioDisciplinas{

	/*
	* Retorna a coleção de disciplinas disponiveis
	* 
	*/
	public function getDisciplinasDisponiveis(){
			
		$strSearchSql = "";
		
		$strSql = "select * from `DISCIPLINAS_".$_SESSION["ID"]."` ".$strSearchSql;

		$result = DbSingleton::getConexao()->query($strSql);
		$disciplinas = array();
		$cont = 0;

		while($row = $result->fetch_array()){
								
			$disciplina = new Disciplina();
			$disciplina->id = $row["COD_DISCIPLINA"];
			$disciplina->nome = $row["NOME_DISCIPLINA"];
			$disciplinas[$cont] = $disciplina;
			$cont++;

		}
		return $disciplinas; 
		/*$disciplinas = array();
		$cont = 0;
		for($i=0; $i<7;$i++){
			$disciplina = new Disciplina();
			$disciplina->id = $cont+1;
			$disciplina->nome = "nome_d".($cont+1);
			$disciplina->turma = "turma_d".($cont+1);
			$disciplinas[$cont] = $disciplina;
			$cont++;	
		}*/
		//return $disciplinas;
	}

	/*
	* Retorna a coleção de disciplinas indesejadas
	* 
	*/
	public function getDisciplinasIndesejadas(){
			
		$strSearchSql = "";
		
		$strSql = "select * from  `INDESEJADAS_".$_SESSION["ID"]."` ".$strSearchSql;
		$result = DbSingleton::getConexao()->query($strSql);

		$disciplinas = array();
		$cont = 0;

		while($row = $result->fetch_array()){
			
			$disciplina = new Disciplina();
			$disciplina->id = $row["COD_DISCIPLINA"];
			$disciplina->nome = $row["NOME_DISCIPLINA"];
			$disciplinas[$cont] = $disciplina;
			$cont++;

		}

		return $disciplinas;
		/*
		$disciplinas = array();
		$cont = 0;
		for($i=0; $i<7;$i++){
			$disciplina = new Disciplina();
			$disciplina->id = "i_".($cont+1);
			$disciplina->nome = "nome_i_".($cont+1);
			$disciplina->turma = "turma_i_".($cont+1);
			$disciplinas[$cont] = $disciplina;
			$cont++;	
		} */
		//return $disciplinas;
	}

	/*
	* Retorna a coleção de disciplinas cursadas
	* 
	*/
	public function getDisciplinasCursadas(){
			
		$strSearchSql = "";
		
		$strSql = "select * from `FEITAS_".$_SESSION["ID"]."` ".$strSearchSql;
		$result = DbSingleton::getConexao()->query($strSql);
		$disciplinas = array();
		$cont = 0;

		while($row = $result->fetch_array()){
			
			$disciplina = new Disciplina();
			$disciplina->id = $row["COD_DISCIPLINA"];
			$disciplina->nome = $row["NOME_DISCIPLINA"];
			$disciplinas[$cont] = $disciplina;
			$cont++;

		}

		return $disciplinas;
		/*	
		$disciplinas = array();
		$cont = 0;
		for($i=0; $i<7;$i++){
			$disciplina = new Disciplina();
			$disciplina->id = $cont+1;
			$disciplina->nome = "nome_c".($cont+1);
			$disciplina->turma = "turma_c".($cont+1);
			$disciplinas[$cont] = $disciplina;
			$cont++;	
		}
		return $disciplinas;
		*/
	}


	public function getDisciplinasSugeridas(){
			
		$strSearchSql = "";
		
		$strSql = "select * from `SUGESTAO_".$_SESSION["ID"]."` ".$strSearchSql;
		$result = DbSingleton::getConexao()->query($strSql);
		$disciplinas = array();
		$cont = 0;

		while($row = $result->fetch_array()){
			
			$disciplina = new Disciplina();
			$disciplina->id = $row["COD_DISC"];
			$disciplina->nome = $row["DISCIPLINA"];
			$disciplina->turma = $row['TURMA'];
			$disciplina->horario = $row['HORARIO'];
			
			$disciplinas[$cont] = $disciplina;
			$cont++;

		}

		return $disciplinas;

		/*
		$disciplinas = array();
		$cont = 0;
		for($i=0; $i<7;$i++){
			$disciplina = new Disciplina();
			$disciplina->id = $cont+1;
			$disciplina->nome = "nome_".($cont+1);
			$disciplina->turma = "turma_".($cont+1);
			$disciplinas[$cont] = $disciplina;
			$cont++;	
		}
		return $disciplinas; */

	}



}

?>